//
//  ViewController.m
//  e家园设计
//
//  Created by lanou on 15/4/13.
//  Copyright (c) 2015年 lanou3g.com. All rights reserved.
//

#import "ViewController.h"
#import "index/IndexViewController.h"
#import "category/CategoryViewController.h"
#import "diary/DiaryViewController.h"
#import "designer/DesignerViewController.h"
#import "personnal/PersonnalViewController.h"
//#import "IndexViewController.h"
//#import "CategoryViewController.h"
//#import "DiaryViewController.h"
//#import "DesignerViewController.h"
//#import "PersonnalViewController.h"

@interface ViewController ()

@end

@implementation ViewController
- (void)dealloc
{
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}

- (void)createTabBar
{
    IndexViewController *index = [[IndexViewController alloc] init];
    NSString *IN_Path = [[NSBundle mainBundle] pathForResource:@"iconfont-shouye" ofType:@"png"];
    UIImage *In_Image = [UIImage imageWithContentsOfFile:IN_Path];
    index.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:In_Image tag:1];
    UINavigationController *IndNav = [[UINavigationController alloc] initWithRootViewController:index];
    [index.tabBarItem release];
    [index release];
    
    CategoryViewController *cate = [[CategoryViewController alloc] init];
    NSString *Ca_Path = [[NSBundle mainBundle] pathForResource:@"iconfont-fenlei" ofType:@"png"];
    UIImage *Ca_image = [UIImage imageWithContentsOfFile:Ca_Path];
    cate.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"分类" image:Ca_image tag:2];
    UINavigationController *CateNav = [[UINavigationController alloc] initWithRootViewController:cate];
    [cate.tabBarItem release];
    [cate release];
    
    DiaryViewController *diary = [[DiaryViewController alloc] init];
    NSString *Di_Path = [[NSBundle mainBundle] pathForResource:@"iconfont-riji" ofType:@"png"];
    UIImage *Di_image = [UIImage imageWithContentsOfFile:Di_Path];
    diary.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"日记" image:Di_image tag:3];
    UINavigationController *DiaNav = [[UINavigationController alloc] initWithRootViewController:diary];
    [diary.tabBarItem release];
    [diary release];
    
    DesignerViewController *designer = [[DesignerViewController alloc] init];
    NSString *De_Path = [[NSBundle mainBundle] pathForResource:@"iconfont-shejishi" ofType:@"png"];
    UIImage *De_image = [UIImage imageWithContentsOfFile:De_Path];
    designer.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"设计师" image:De_image tag:4];
    UINavigationController *DesNav = [[UINavigationController alloc] initWithRootViewController:designer];
    [designer.tabBarItem release];
    [designer release];
    
    PersonnalViewController *person = [[PersonnalViewController alloc] init];
    NSString *Pe_Path = [[NSBundle mainBundle] pathForResource:@"iconfont-user" ofType:@"png"];
    UIImage *Pe_image = [UIImage imageWithContentsOfFile:Pe_Path];
    person.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"个人中心" image:Pe_image tag:5];
    UINavigationController *perNav = [[UINavigationController alloc] initWithRootViewController:person];
    [person.tabBarItem release];
    [person release];
    
    
    
    UITabBarController *tabBar = [[UITabBarController alloc] init];
    [self addChildViewController:tabBar];
    [self.view addSubview:tabBar.view];
    [tabBar release];
    tabBar.viewControllers = @[IndNav, CateNav, DiaNav, DesNav, perNav];
    [IndNav release];
    [CateNav release];
    [DiaNav release];
    [DesNav release];
    [perNav release];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self createTabBar];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
